/*******************************************************************************
 *
 * File:        STUB_PLIB.c
 * Progetto:    Robottino
 * Ambiente:    PIC32
 * Data:        14/03/2012
 * Autore:      M. Tili
 * Versione:    00.00
 *
 * Descrizione: 
 *   Modulo di STUB per plib.h.
 *   Usato per la compilazione in ambiente VS Windows.
 *
 *
 * Modifica:  gg/mm/aaaa  | N.Cognome
 *                        | Descrizione modifica
 *
 */
#include "CONFIG.h"
#include "STUB_PLIB.h"
//#ifdef _MSC_VER      
  #include <Windows.h>
//#endif


unsigned char stub_led_0;
unsigned char stub_led_1;
unsigned char stub_led_2;
unsigned char stub_key_0;
unsigned char stub_key_1;
unsigned char stub_key_2;


int          SYSTEMConfig(unsigned int _bits,unsigned int _bits2)
{
  stub_led_0 = 0x00;
  stub_led_1 = 0x00;
  stub_led_2 = 0x00;
  stub_key_0 = 0x00;
  stub_key_1 = 0x00;
  stub_key_2 = 0x00;
return 0;
}


void         mPORTDSetPinsDigitalOut (unsigned int _bits)
{

}
void         mPORTDSetPinsDigitalIn  (unsigned int _bits)
{

}

unsigned int mPORTDReadBits(unsigned int _bits)
{
  unsigned int retVal;
  switch (_bits)
  {
    case 0:
      retVal = stub_key_0;
      break;
    case 1:
      retVal = stub_key_1;
      break;
    case 2:
      retVal = stub_key_2;
      break;
    default:
      retVal = 0;
      break;
  }
  return retVal;
}

void         mPORTDClearBits(unsigned int _bits)
{
  switch (_bits)
  {
    case 6:
      stub_led_0 = 0x00;
      break;
    case 7:
      stub_led_1 = 0x00;
      break;
    case 13:
      stub_led_2 = 0x00;
      break;
    default:
      break;
  }
}

void         mPORTDSetBits(unsigned int _bits)
{
  switch (_bits)
  {
    case 6:
      stub_led_0 = 0x01;
      break;
    case 7:
      stub_led_1 = 0x01;
      break;
    case 13:
      stub_led_2 = 0x01;
      break;
    default:
      break;
  }
}

void         PORTSetPinsDigitalIn(IO_PORT_ID port, unsigned int inputs)
{

}

void         PORTSetPinsDigitalOut(IO_PORT_ID port, unsigned int inputs)
{

}

void         PORTClearBits(IO_PORT_ID port, unsigned int bits)
{

}

unsigned int ReadCoreTimer(void)
{
  SYSTEMTIME systemTime;
  GetSystemTime( &systemTime );
  return (int) systemTime.wMilliseconds;
}


